<!DOCTYPE html>
<html lang=zh>
<head>
    <!-- so meta -->
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="HandheldFriendly" content="True">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />
    <meta name="description" content="在没有尝到IDEA REST之前，postman（chrome的一款插件）确实是一个非常不错的选择，具有完备的REST Client功能和请求历史记录功能。 但是当使用了IDEA REST之后，postman就可以丢了，因为，IDEA REST Client具有postman的所有功能，而且还有postman没有的功能，继续往下看。 从postman到IDEA REST Client postma">
<meta property="og:type" content="article">
<meta property="og:title" content="从postman转到IDEA的REST Client来发送请求测试接口">
<meta property="og:url" content="https:&#x2F;&#x2F;fengzxia.gitee.io&#x2F;posts&#x2F;34f6d968.html">
<meta property="og:site_name" content="只是学习学习的博客">
<meta property="og:description" content="在没有尝到IDEA REST之前，postman（chrome的一款插件）确实是一个非常不错的选择，具有完备的REST Client功能和请求历史记录功能。 但是当使用了IDEA REST之后，postman就可以丢了，因为，IDEA REST Client具有postman的所有功能，而且还有postman没有的功能，继续往下看。 从postman到IDEA REST Client postma">
<meta property="og:locale" content="zh_CN">
<meta property="og:image" content="https:&#x2F;&#x2F;img-blog.csdnimg.cn&#x2F;20191120135953271.png?x-oss-process&#x3D;image&#x2F;watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3FxXzMzNDMwMDgz,size_16,color_FFFFFF,t_70">
<meta property="og:image" content="https:&#x2F;&#x2F;img-blog.csdnimg.cn&#x2F;20191120140054177.png">
<meta property="og:image" content="https:&#x2F;&#x2F;img-blog.csdnimg.cn&#x2F;20191120140331282.png">
<meta property="og:image" content="https:&#x2F;&#x2F;img-blog.csdnimg.cn&#x2F;20191120140435739.png">
<meta property="og:image" content="https:&#x2F;&#x2F;img-blog.csdnimg.cn&#x2F;20191120140539775.png">
<meta property="og:image" content="https:&#x2F;&#x2F;img-blog.csdnimg.cn&#x2F;20191120140630406.png">
<meta property="og:image" content="https:&#x2F;&#x2F;img-blog.csdnimg.cn&#x2F;20191120140659243.png">
<meta property="og:image" content="https:&#x2F;&#x2F;img-blog.csdnimg.cn&#x2F;20191120141227541.png">
<meta property="article:published_time" content="2019-11-20T06:20:33.000Z">
<meta property="article:modified_time" content="2020-04-17T10:28:04.499Z">
<meta property="article:author" content="只是学习学习">
<meta property="article:tag" content="接口测试">
<meta name="twitter:card" content="summary">
<meta name="twitter:image" content="https:&#x2F;&#x2F;img-blog.csdnimg.cn&#x2F;20191120135953271.png?x-oss-process&#x3D;image&#x2F;watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3FxXzMzNDMwMDgz,size_16,color_FFFFFF,t_70">
    
    
        
          
              <link rel="shortcut icon" href="/images/favicon.ico">
          
        
        
          
            <link rel="icon" type="image/png" href="/images/favicon-192x192.png" sizes="192x192">
          
        
        
          
            <link rel="apple-touch-icon" sizes="180x180" href="/images/apple-touch-icon.png">
          
        
    
    <!-- title -->
    <title>从postman转到IDEA的REST Client来发送请求测试接口</title>
    <!-- styles -->
    
<link rel="stylesheet" href="/css/style.css">

    <!-- persian styles -->
    
      
<link rel="stylesheet" href="/css/rtl.css">

    
    <!-- rss -->
    
    
    
<meta name="generator" content="Hexo 4.1.1"></head>

<body class="max-width mx-auto px3 ltr">
    
      <div id="header-post">
  <a id="menu-icon" href="#"><i class="fas fa-bars fa-lg"></i></a>
  <a id="menu-icon-tablet" href="#"><i class="fas fa-bars fa-lg"></i></a>
  <a id="top-icon-tablet" href="#" onclick="$('html, body').animate({ scrollTop: 0 }, 'fast');" style="display:none;"><i class="fas fa-chevron-up fa-lg"></i></a>
  <span id="menu">
    <span id="nav">
      <ul>
         
          <li><a href="/">主页</a></li>
         
          <li><a href="/archives/">归档</a></li>
         
          <li><a href="/categories/">分类</a></li>
         
          <li><a href="/tags/">标签</a></li>
         
          <li><a href="/search/">搜索</a></li>
         
          <li><a href="/about/">关于</a></li>
         
          <li><a href="/friend_ship/">友链</a></li>
        
      </ul>
    </span>
    <br/>
    <span id="actions">
      <ul>
        
        <li><a class="icon" href="/posts/be076923.html"><i class="fas fa-chevron-left" aria-hidden="true" onmouseover="$('#i-prev').toggle();" onmouseout="$('#i-prev').toggle();"></i></a></li>
        
        
        <li><a class="icon" href="/posts/6d526f28.html"><i class="fas fa-chevron-right" aria-hidden="true" onmouseover="$('#i-next').toggle();" onmouseout="$('#i-next').toggle();"></i></a></li>
        
        <li><a class="icon" href="#" onclick="$('html, body').animate({ scrollTop: 0 }, 'fast');"><i class="fas fa-chevron-up" aria-hidden="true" onmouseover="$('#i-top').toggle();" onmouseout="$('#i-top').toggle();"></i></a></li>
        <li><a class="icon" href="#"><i class="fas fa-share-alt" aria-hidden="true" onmouseover="$('#i-share').toggle();" onmouseout="$('#i-share').toggle();" onclick="$('#share').toggle();return false;"></i></a></li>
      </ul>
      <span id="i-prev" class="info" style="display:none;">上一篇</span>
      <span id="i-next" class="info" style="display:none;">下一篇</span>
      <span id="i-top" class="info" style="display:none;">返回顶部</span>
      <span id="i-share" class="info" style="display:none;">分享文章</span>
    </span>
    <br/>
    <div id="share" style="display: none">
      <ul>
  <li><a class="icon" href="http://www.facebook.com/sharer.php?u=https://fengzxia.gitee.io/posts/34f6d968.html" target="_blank" rel="noopener"><i class="fab fa-facebook " aria-hidden="true"></i></a></li>
  <li><a class="icon" href="https://twitter.com/share?url=https://fengzxia.gitee.io/posts/34f6d968.html&text=从postman转到IDEA的REST Client来发送请求测试接口" target="_blank" rel="noopener"><i class="fab fa-twitter " aria-hidden="true"></i></a></li>
  <li><a class="icon" href="http://www.linkedin.com/shareArticle?url=https://fengzxia.gitee.io/posts/34f6d968.html&title=从postman转到IDEA的REST Client来发送请求测试接口" target="_blank" rel="noopener"><i class="fab fa-linkedin " aria-hidden="true"></i></a></li>
  <li><a class="icon" href="https://pinterest.com/pin/create/bookmarklet/?url=https://fengzxia.gitee.io/posts/34f6d968.html&is_video=false&description=从postman转到IDEA的REST Client来发送请求测试接口" target="_blank" rel="noopener"><i class="fab fa-pinterest " aria-hidden="true"></i></a></li>
  <li><a class="icon" href="mailto:?subject=从postman转到IDEA的REST Client来发送请求测试接口&body=Check out this article: https://fengzxia.gitee.io/posts/34f6d968.html"><i class="fas fa-envelope " aria-hidden="true"></i></a></li>
  <li><a class="icon" href="https://getpocket.com/save?url=https://fengzxia.gitee.io/posts/34f6d968.html&title=从postman转到IDEA的REST Client来发送请求测试接口" target="_blank" rel="noopener"><i class="fab fa-get-pocket " aria-hidden="true"></i></a></li>
  <li><a class="icon" href="http://reddit.com/submit?url=https://fengzxia.gitee.io/posts/34f6d968.html&title=从postman转到IDEA的REST Client来发送请求测试接口" target="_blank" rel="noopener"><i class="fab fa-reddit " aria-hidden="true"></i></a></li>
  <li><a class="icon" href="http://www.stumbleupon.com/submit?url=https://fengzxia.gitee.io/posts/34f6d968.html&title=从postman转到IDEA的REST Client来发送请求测试接口" target="_blank" rel="noopener"><i class="fab fa-stumbleupon " aria-hidden="true"></i></a></li>
  <li><a class="icon" href="http://digg.com/submit?url=https://fengzxia.gitee.io/posts/34f6d968.html&title=从postman转到IDEA的REST Client来发送请求测试接口" target="_blank" rel="noopener"><i class="fab fa-digg " aria-hidden="true"></i></a></li>
  <li><a class="icon" href="http://www.tumblr.com/share/link?url=https://fengzxia.gitee.io/posts/34f6d968.html&name=从postman转到IDEA的REST Client来发送请求测试接口&description=" target="_blank" rel="noopener"><i class="fab fa-tumblr " aria-hidden="true"></i></a></li>
  <li><a class="icon" href="https://news.ycombinator.com/submitlink?u=https://fengzxia.gitee.io/posts/34f6d968.html&t=从postman转到IDEA的REST Client来发送请求测试接口" target="_blank" rel="noopener"><i class="fab fa-hacker-news " aria-hidden="true"></i></a></li>
</ul>

    </div>
    <div id="toc">
      <ol class="toc"><li class="toc-item toc-level-2"><a class="toc-link" href="#从postman到IDEA-REST-Client"><span class="toc-number">1.</span> <span class="toc-text">从postman到IDEA REST Client</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#IDEA-REST-Client控制台"><span class="toc-number">2.</span> <span class="toc-text">IDEA REST Client控制台</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#历史请求记录"><span class="toc-number">3.</span> <span class="toc-text">历史请求记录</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#构建HTTP请求脚本"><span class="toc-number">4.</span> <span class="toc-text">构建HTTP请求脚本</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#语法部分"><span class="toc-number">4.1.</span> <span class="toc-text">语法部分</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#环境区分"><span class="toc-number">4.2.</span> <span class="toc-text">环境区分</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#结果断言"><span class="toc-number">4.3.</span> <span class="toc-text">结果断言</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#结果值暂存"><span class="toc-number">4.4.</span> <span class="toc-text">结果值暂存</span></a></li></ol></li></ol>
    </div>
  </span>
</div>

    
    <div class="content index py4">
        
        <article class="post" itemscope itemtype="http://schema.org/BlogPosting">
  <header>
    
    <h1 class="posttitle" itemprop="name headline">
        从postman转到IDEA的REST Client来发送请求测试接口
    </h1>



    <div class="meta">
      <span class="author" itemprop="author" itemscope itemtype="http://schema.org/Person">
        <span itemprop="name">只是学习学习的博客</span>
      </span>
      
    <div class="postdate">
      
        <time datetime="2019-11-20T06:20:33.000Z" itemprop="datePublished">2019-11-20</time>
        
      
    </div>


      
    <div class="article-category">
        <i class="fas fa-archive"></i>
        <a class="category-link" href="/categories/idea/">idea</a> › <a class="category-link" href="/categories/%E6%B5%8B%E8%AF%95/">测试</a> › <a class="category-link" href="/categories/%E6%B5%8B%E8%AF%95/PostMain/">PostMain</a> › <a class="category-link" href="/categories/%E8%BD%AC%E8%BD%BD/">转载</a>
    </div>


      
    <div class="article-tag">
        <i class="fas fa-tag"></i>
        <a class="tag-link" href="/tags/%E6%8E%A5%E5%8F%A3%E6%B5%8B%E8%AF%95/" rel="tag">接口测试</a>
    </div>


    </div>
  </header>
  

  <div class="content"itemprop ="articleBody">
    <p>在没有尝到IDEA REST之前，postman（chrome的一款插件）确实是一个非常不错的选择，具有完备的REST Client功能和请求历史记录功能。</p>
<p>但是当使用了IDEA REST之后，postman就可以丢了，因为，IDEA REST Client具有postman的所有功能，而且还有postman没有的功能，继续往下看。</p>
<h2 id="从postman到IDEA-REST-Client"><a href="#从postman到IDEA-REST-Client" class="headerlink" title="从postman到IDEA REST Client"></a>从postman到IDEA REST Client</h2><blockquote>
<p>postman的所有功能IDEA REST Client都具备了，如REST Client控制台和历史请求记录<br>如果能够在一个生产工具里完成开发和调试的事情，干嘛要切换到另一个工具呢<br>然后IDEA REST Client还支持环境配置区分的功能，以及接口响应断言和脚本化处理的能力<br>IDEA REST Client的请求配置可以用文件配置描述，所以可以跟随项目和项目成员共享</p>
</blockquote>
<h2 id="IDEA-REST-Client控制台"><a href="#IDEA-REST-Client控制台" class="headerlink" title="IDEA REST Client控制台"></a>IDEA REST Client控制台</h2><p>从顶层工具栏依次<code>Tools -&gt; HTTP Client -&gt; Test RESTFUL Web Service</code> 打开后<br>![在这里插入图片描述](<a href="https://img-blog.csdnimg.cn/20191120135935338.png" target="_blank" rel="noopener">https://img-blog.csdnimg.cn/20191120135935338.png</a><br>IDEA REST Client控制台的界面如下样式：<br><img src="https://img-blog.csdnimg.cn/20191120135953271.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3FxXzMzNDMwMDgz,size_16,color_FFFFFF,t_70" alt="在这里插入图片描述"><br>可以看到，这个控制台展示的功能区和postman已经没什么差别了，包括请求方式，请求参数和请求头的填充都已经包含了，特别说明下的是，如果请求的方式是Authorization :Basic这种方式认证的话，可以点击下图所示的按钮，会弹出填充用户名和密码的窗口出来，填完后会自动补充到Authorization 的header里面去<br><img src="https://img-blog.csdnimg.cn/20191120140054177.png" alt="在这里插入图片描述"></p>
<h2 id="历史请求记录"><a href="#历史请求记录" class="headerlink" title="历史请求记录"></a>历史请求记录</h2><p>IntelliJ IDEA自动将最近执行的50个请求保存到<code>http-requests-log.http</code> 文件中，该文件存储在项目的<code>.idea/httpRequests/</code>目录下。使用请求历史记录，您可以快速导航到特定响应并再次发出请求。<br>打开方式：<br>第一步，点击蓝色部分的文字会打开上次请求的代码（如果没有，请先发送一次请求）: <img src="https://img-blog.csdnimg.cn/20191120140331282.png" alt="在这里插入图片描述"><br>打开后：<br><img src="https://img-blog.csdnimg.cn/20191120140435739.png" alt="在这里插入图片描述"><br>可点击左侧的开始按钮直接发出上次的请求<br><img src="https://img-blog.csdnimg.cn/20191120140539775.png" alt="在这里插入图片描述"><br>第二步，点击右边类似钟表的按钮即可打开请求历史记录:<br><img src="https://img-blog.csdnimg.cn/20191120140630406.png" alt="在这里插入图片描述"><br>点击后:<br><img src="https://img-blog.csdnimg.cn/20191120140659243.png" alt="在这里插入图片描述"><br>再次发出请求只要点击那个运行按钮即可。如果从请求历史记录再次发出请求，则其执行信息和响应输出的链接将添加到请求历史记录文件的顶部。</p>
<h2 id="构建HTTP请求脚本"><a href="#构建HTTP请求脚本" class="headerlink" title="构建HTTP请求脚本"></a>构建HTTP请求脚本</h2><p>上面的历史记录就是一个完整的IDEA REST Client请求脚本，如果你是从控制台触发的，那么可以直接复制历史请求记录的文件放到项目里作为HTTP请求的脚本，给其他成员共享，如果不是，也可以直接新建一个.http或者.rest结尾的文件，IDEA会自动识别为HTTP请求脚本。</p>
<h3 id="语法部分"><a href="#语法部分" class="headerlink" title="语法部分"></a>语法部分</h3><figure class="highlight"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br></pre></td><td class="code"><pre><span class="line">### 演示POST请求</span><br><span class="line">POST &#123;&#123;baseUrl&#125;&#125;&#125;get?show_env=1</span><br><span class="line"><span class="attribute">Accept</span>: application/json</span><br><span class="line"></span><br><span class="line">&#123;</span><br><span class="line">   "name":"a"</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line">### 演示GET请求</span><br><span class="line"></span><br><span class="line">GET &#123;&#123;baseUrl&#125;&#125;&#125;/post</span><br><span class="line"><span class="attribute">Content-Type</span>: application/x-www-form-urlencoded</span><br><span class="line"></span><br><span class="line">id=999&amp;value=content</span><br></pre></td></tr></table></figure>

<p>首先通过###三个井号键来分开每个请求体，然后请求url和header参数是紧紧挨着的，请求参数不管是POST的body传参还是GET的parameter传参，都是要换行的</p>
<h3 id="环境区分"><a href="#环境区分" class="headerlink" title="环境区分"></a>环境区分</h3><p>细心的你可能发现了上面示例的代码，没有真实的请求地址，取而代之的，是一个<code></code>的占位符，这个就是IDEA REST Client好用的地方，支持从指定的配置文件中获取到环境相关的配置参数，不仅<code>baseUrl</code>可以通过占位符替换，一些请求的参数如果和接口环境相关的都可以通过配置文件来区分。</p>
<p>首先在.http的脚本同目录下创建一个名为<code>http-client.private.env.json</code>的文件，然后内容如下，一级的key值时用来区分环境的，比如，<code>dev</code>、<code>uat</code>、<code>pro</code>等，环境下的对象就是一次HTTP请求中能够获取到的环境变量了，你可以直接在请求的HTTP的脚本中通过<code></code>占位符的方式获取到这里配置的参数</p>
<figure class="highlight json"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br></pre></td><td class="code"><pre><span class="line">&#123;</span><br><span class="line">  <span class="attr">"uat"</span>: &#123;</span><br><span class="line">    <span class="attr">"baseUrl"</span>: <span class="string">"http://gateway.xxx.cn/"</span>,</span><br><span class="line">    <span class="attr">"username"</span>: <span class="string">""</span>,</span><br><span class="line">    <span class="attr">"password"</span>: <span class="string">""</span></span><br><span class="line">  &#125;,</span><br><span class="line">  <span class="attr">"dev"</span>: &#123;</span><br><span class="line">    <span class="attr">"baseUrl"</span>: <span class="string">"http://localhsot:8888/"</span>,</span><br><span class="line">    <span class="attr">"username"</span>: <span class="string">""</span>,</span><br><span class="line">    <span class="attr">"password"</span>: <span class="string">""</span></span><br><span class="line">  &#125;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure>
<p>那么在选择执行请求的时候，IDEA就会让你选执行那个环境的配置，如：<br><img src="https://img-blog.csdnimg.cn/20191120141227541.png" alt="在这里插入图片描述"></p>
<h3 id="结果断言"><a href="#结果断言" class="headerlink" title="结果断言"></a>结果断言</h3><p>IDEA REST Client可以针对接口的响应值进行脚本化的断言处理，立马从一个接口调试工具上升到测试工具了，比如：</p>
<figure class="highlight"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line">### Successful test: check response status is 200</span><br><span class="line">GET https://httpbin.org/status/200</span><br><span class="line"></span><br><span class="line">&gt; &#123;%</span><br><span class="line">client.test("Request executed successfully", function() &#123;</span><br><span class="line">  client.assert(response.status === 200, "Response status is not 200");</span><br><span class="line">&#125;);</span><br><span class="line">%&#125;</span><br></pre></td></tr></table></figure>

<h3 id="结果值暂存"><a href="#结果值暂存" class="headerlink" title="结果值暂存"></a>结果值暂存</h3><p>当一个系统需要通过认证才能访问的时候，如果用postman的时候，需要先访问登录接口，然后获得token后，手动粘贴复制到新的调试接口的header参数里面去，这太麻烦了，IDEA REST Client还有一个很好用的功能，可以完美解决这个问题，请看下面的脚本：</p>
<figure class="highlight http"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br></pre></td><td class="code"><pre><span class="line">### 演示POST请求</span><br><span class="line">POST https://httpbin.org/post</span><br><span class="line"><span class="attribute">Content-Type</span>: application/json</span><br><span class="line"></span><br><span class="line">&#123;</span><br><span class="line">  "user": "admin",</span><br><span class="line">  "password": "123456"</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line">&gt; &#123;% client.global.set("auth_token", response.body.json.token); %&#125;</span><br><span class="line">### 演示GET请求</span><br><span class="line"></span><br><span class="line">GET https://httpbin.org/headers</span><br><span class="line"><span class="attribute">Authorization</span>: Bearer &#123;&#123;auth_token&#125;&#125;</span><br></pre></td></tr></table></figure>
<p>在第一个认证的请求结束后，可以在response里拿到返回的token信息，然后我们通过脚本设置到了全局变量里，那么在接下来的接口请求中，就可以直接使用双大括号占位符的方式获取到这个token了</p>

<div id="gitalk-container"></div>
<script src="https://cdn.bootcss.com/blueimp-md5/2.12.0/js/md5.min.js"></script><link rel="stylesheet" href="https://unpkg.com/gitalk/dist/gitalk.css"><script src="https://unpkg.com/gitalk/dist/gitalk.min.js"></script>

		<script>
		var gitalkConfig = {"clientID":"28a065e3b5afee156f4f","clientSecret":"e18104d6f3219526491fc42c892ff6a26b8f3e74","repo":"blog_comment","owner":"FENG1000","admin":["FENG1000"],"distractionFreeMode":false};
	    gitalkConfig.id = md5(location.pathname);
		var gitalk = new Gitalk(gitalkConfig);
	    gitalk.render("gitalk-container");
	    </script>
    
  </div>
</article>




        
          <div id="footer-post-container">
  <div id="footer-post">

    <div id="nav-footer" style="display: none">
      <ul>
         
          <li><a href="/">主页</a></li>
         
          <li><a href="/archives/">归档</a></li>
         
          <li><a href="/categories/">分类</a></li>
         
          <li><a href="/tags/">标签</a></li>
         
          <li><a href="/search/">搜索</a></li>
         
          <li><a href="/about/">关于</a></li>
         
          <li><a href="/friend_ship/">友链</a></li>
        
      </ul>
    </div>

    <div id="toc-footer" style="display: none">
      <ol class="toc"><li class="toc-item toc-level-2"><a class="toc-link" href="#从postman到IDEA-REST-Client"><span class="toc-number">1.</span> <span class="toc-text">从postman到IDEA REST Client</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#IDEA-REST-Client控制台"><span class="toc-number">2.</span> <span class="toc-text">IDEA REST Client控制台</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#历史请求记录"><span class="toc-number">3.</span> <span class="toc-text">历史请求记录</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#构建HTTP请求脚本"><span class="toc-number">4.</span> <span class="toc-text">构建HTTP请求脚本</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#语法部分"><span class="toc-number">4.1.</span> <span class="toc-text">语法部分</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#环境区分"><span class="toc-number">4.2.</span> <span class="toc-text">环境区分</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#结果断言"><span class="toc-number">4.3.</span> <span class="toc-text">结果断言</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#结果值暂存"><span class="toc-number">4.4.</span> <span class="toc-text">结果值暂存</span></a></li></ol></li></ol>
    </div>

    <div id="share-footer" style="display: none">
      <ul>
  <li><a class="icon" href="http://www.facebook.com/sharer.php?u=https://fengzxia.gitee.io/posts/34f6d968.html" target="_blank" rel="noopener"><i class="fab fa-facebook fa-lg" aria-hidden="true"></i></a></li>
  <li><a class="icon" href="https://twitter.com/share?url=https://fengzxia.gitee.io/posts/34f6d968.html&text=从postman转到IDEA的REST Client来发送请求测试接口" target="_blank" rel="noopener"><i class="fab fa-twitter fa-lg" aria-hidden="true"></i></a></li>
  <li><a class="icon" href="http://www.linkedin.com/shareArticle?url=https://fengzxia.gitee.io/posts/34f6d968.html&title=从postman转到IDEA的REST Client来发送请求测试接口" target="_blank" rel="noopener"><i class="fab fa-linkedin fa-lg" aria-hidden="true"></i></a></li>
  <li><a class="icon" href="https://pinterest.com/pin/create/bookmarklet/?url=https://fengzxia.gitee.io/posts/34f6d968.html&is_video=false&description=从postman转到IDEA的REST Client来发送请求测试接口" target="_blank" rel="noopener"><i class="fab fa-pinterest fa-lg" aria-hidden="true"></i></a></li>
  <li><a class="icon" href="mailto:?subject=从postman转到IDEA的REST Client来发送请求测试接口&body=Check out this article: https://fengzxia.gitee.io/posts/34f6d968.html"><i class="fas fa-envelope fa-lg" aria-hidden="true"></i></a></li>
  <li><a class="icon" href="https://getpocket.com/save?url=https://fengzxia.gitee.io/posts/34f6d968.html&title=从postman转到IDEA的REST Client来发送请求测试接口" target="_blank" rel="noopener"><i class="fab fa-get-pocket fa-lg" aria-hidden="true"></i></a></li>
  <li><a class="icon" href="http://reddit.com/submit?url=https://fengzxia.gitee.io/posts/34f6d968.html&title=从postman转到IDEA的REST Client来发送请求测试接口" target="_blank" rel="noopener"><i class="fab fa-reddit fa-lg" aria-hidden="true"></i></a></li>
  <li><a class="icon" href="http://www.stumbleupon.com/submit?url=https://fengzxia.gitee.io/posts/34f6d968.html&title=从postman转到IDEA的REST Client来发送请求测试接口" target="_blank" rel="noopener"><i class="fab fa-stumbleupon fa-lg" aria-hidden="true"></i></a></li>
  <li><a class="icon" href="http://digg.com/submit?url=https://fengzxia.gitee.io/posts/34f6d968.html&title=从postman转到IDEA的REST Client来发送请求测试接口" target="_blank" rel="noopener"><i class="fab fa-digg fa-lg" aria-hidden="true"></i></a></li>
  <li><a class="icon" href="http://www.tumblr.com/share/link?url=https://fengzxia.gitee.io/posts/34f6d968.html&name=从postman转到IDEA的REST Client来发送请求测试接口&description=" target="_blank" rel="noopener"><i class="fab fa-tumblr fa-lg" aria-hidden="true"></i></a></li>
  <li><a class="icon" href="https://news.ycombinator.com/submitlink?u=https://fengzxia.gitee.io/posts/34f6d968.html&t=从postman转到IDEA的REST Client来发送请求测试接口" target="_blank" rel="noopener"><i class="fab fa-hacker-news fa-lg" aria-hidden="true"></i></a></li>
</ul>

    </div>

    <div id="actions-footer">
        <a id="menu" class="icon" href="#" onclick="$('#nav-footer').toggle();return false;"><i class="fas fa-bars fa-lg" aria-hidden="true"></i> 菜单</a>
        <a id="toc" class="icon" href="#" onclick="$('#toc-footer').toggle();return false;"><i class="fas fa-list fa-lg" aria-hidden="true"></i> 目录</a>
        <a id="share" class="icon" href="#" onclick="$('#share-footer').toggle();return false;"><i class="fas fa-share-alt fa-lg" aria-hidden="true"></i> 分享</a>
        <a id="top" style="display:none" class="icon" href="#" onclick="$('html, body').animate({ scrollTop: 0 }, 'fast');"><i class="fas fa-chevron-up fa-lg" aria-hidden="true"></i> 返回顶部</a>
    </div>

  </div>
</div>

        
        <footer id="footer">
  <div class="footer-left">
    Copyright &copy;
    
    
    2019-2020
    只是学习学习
  </div>
  <div class="footer-right">
    <nav>
      <ul>
         
          <li><a href="/">主页</a></li>
         
          <li><a href="/archives/">归档</a></li>
         
          <li><a href="/categories/">分类</a></li>
         
          <li><a href="/tags/">标签</a></li>
         
          <li><a href="/search/">搜索</a></li>
         
          <li><a href="/about/">关于</a></li>
         
          <li><a href="/friend_ship/">友链</a></li>
        
      </ul>
    </nav>
  </div>
</footer>

    </div>
    <!-- styles -->

<link rel="stylesheet" href="/lib/font-awesome/css/all.min.css">


<link rel="stylesheet" href="/lib/justified-gallery/css/justifiedGallery.min.css">


    <!-- jquery -->

<script src="/lib/jquery/jquery.min.js"></script>


<script src="/lib/justified-gallery/js/jquery.justifiedGallery.min.js"></script>

<!-- clipboard -->

  
<script src="/lib/clipboard/clipboard.min.js"></script>

  <script type="text/javascript">
  $(function() {
    // copy-btn HTML
    var btn = "<span class=\"btn-copy tooltipped tooltipped-sw\" aria-label=\"复制到粘贴板!\">";
    btn += '<i class="far fa-clone"></i>';
    btn += '</span>'; 
    // mount it!
    $(".highlight table").before(btn);
    var clip = new ClipboardJS('.btn-copy', {
      text: function(trigger) {
        return Array.from(trigger.nextElementSibling.querySelectorAll('.code')).reduce((str,it)=>str+it.innerText+'\n','')
      }
    });
    clip.on('success', function(e) {
      e.trigger.setAttribute('aria-label', "复制成功!");
      e.clearSelection();
    })
  })
  </script>


<script src="/js/main.js"></script>

<!-- search -->

<!-- Google Analytics -->

<!-- Baidu Analytics -->

    <script type="text/javascript">
        var _hmt = _hmt || [];
        (function() {
            var hm = document.createElement("script");
            hm.src = "https://hm.baidu.com/hm.js?54382acbd8c4bc66535bce135e0ac166";
            var s = document.getElementsByTagName("script")[0];
            s.parentNode.insertBefore(hm, s);
        })();
    </script>

<!-- Disqus Comments -->


</body>
<script>
(function(){
    var bp = document.createElement('script');
    var curProtocol = window.location.protocol.split(':')[0];
    if (curProtocol === 'https'){
   bp.src = 'https://zz.bdstatic.com/linksubmit/push.js';
  }
  else{
  bp.src = 'http://push.zhanzhang.baidu.com/push.js';
  }
    var s = document.getElementsByTagName("script")[0];
    s.parentNode.insertBefore(bp, s);
})();
</script>
</html>
